LocaleEdit
Base classes
| Name |
Children |
Inherits |
ComboBox prettyqt.widgets.combobox Combined button and popup list. |
|
|
⋔ Inheritance diagram
graph TD
2995172399["custom_widgets.LocaleEdit"]
2460391555["widgets.ComboBox"]
1955118198["widgets.ComboBoxMixin"]
829357528["widgets.WidgetMixin"]
3227531497["core.ObjectMixin"]
2751680898["builtins.object"]
625385617["gui.PaintDeviceMixin"]
1844689747["QtWidgets.QComboBox"]
3620195106["QtWidgets.QWidget"]
3984060476["QtCore.QObject"]
37984305["Shiboken.Object"]
673956333["QtGui.QPaintDevice"]
2460391555 --> 2995172399
1955118198 --> 2460391555
829357528 --> 1955118198
3227531497 --> 829357528
2751680898 --> 3227531497
625385617 --> 829357528
2751680898 --> 625385617
1844689747 --> 2460391555
3620195106 --> 1844689747
3984060476 --> 3620195106
37984305 --> 3984060476
2751680898 --> 37984305
673956333 --> 3620195106
37984305 --> 673956333
🛈 DocStrings
Bases: ComboBox
Source code in prettyqt/custom_widgets/editors/localeedit.py
| class LocaleEdit(widgets.ComboBox):
value_changed = core.Signal(core.Locale)
def __init__(
self,
locale: core.QLocale | None = None,
object_name: str = "locale_edit",
**kwargs,
):
super().__init__(object_name=object_name, **kwargs)
self._current_locale = core.Locale()
for i in core.Locale.get_all_locales():
self.addItem(i.bcp47Name())
if locale is not None:
self.set_current_locale(locale)
self.currentTextChanged.connect(self.set_current_locale)
def __repr__(self):
return get_repr(self, self._current_locale)
def clear(self):
self._current_locale = core.Locale()
super().clear()
for i in core.Locale.get_all_locales():
self.addItem(i.bcp47Name())
# def _on_value_change(self):
# self._value = self.get_value()
# self.value_changed.emit(self._value)
def set_current_locale(self, locale: core.QLocale | str):
self._current_locale = core.Locale(locale)
self.setCurrentText(self._current_locale.bcp47Name())
def is_valid(self) -> bool:
return self._current_locale.isValid()
def get_value(self) -> core.QLocale:
return self._current_locale
def set_value(self, value: core.QLocale | str):
self.set_current_locale(value)
value = core.Property(
core.QLocale,
get_value,
set_value,
user=True,
doc="Currently chosen locale",
)
|
:fa-brands-github: Show source on GitHub